//
//  Potts_tabViewController.m
//  potts_BaiSiBuDeJie
//
//  Created by Pottsmo on 16/4/24.
//  Copyright © 2016年 Pottsmo. All rights reserved.
//

#import "Potts_tabViewController.h"
#import "Potts_EssenceViewController.h"
#import "Potts_FriendTrendViewController.h"
#import "Potts_MeViewController.h"
#import "Potts_NewViewController.h"
#import "Potts_PublishViewController.h"

@interface Potts_tabViewController ()

@end

@implementation Potts_tabViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    设置tabbar背景
    [self.tabBar setBackgroundImage:[UIImage imageNamed:@"tabbar-light"]];
    // 添加所有的子控制器
    [self setupALLchildVC];
    // 设置子控制器的title
    [self setupChildVCtitle];
    
}

-(void)setupChildVCtitle
{
//   /********************** 精华**************************************/
    Potts_EssenceViewController *vc1 = self.childViewControllers[0];
    [vc1.navigationItem setTitle:@"精华"];
    [vc1.tabBarItem setImage:[UIImage imageNamed:@"tabBar_essence_icon"]];
    [vc1.tabBarItem setTitle:@"精华"];
    [vc1.tabBarItem setSelectedImage:[UIImage imageNamed:@"tabBar_essence_click_icon"]];

//   /********************** 关注**************************************/
    Potts_FriendTrendViewController *vc2 = self.childViewControllers[1];
    [vc2.navigationItem setTitle:@"关注"];
    [vc2.tabBarItem setTitle:@"关注"];
    
    [vc2.tabBarItem setImage:[UIImage imageNamed:@"tabBar_friendTrends_icon"]];
    [vc2.tabBarItem setSelectedImage:[UIImage imageNamed:@"tabBar_friendTrends_click_icon"]];

    /********************** 新帖**************************************/
    
    Potts_PublishViewController *vcSp = self.childViewControllers[2];
    [vcSp.tabBarItem setImage:[UIImage imageNamed:@"tabBar_publish_icon"]];
    [vcSp.tabBarItem setSelectedImage:[UIImage imageNamed:@"tabBar_publish_click_icon"]];
    /********************** 新帖**************************************/
    Potts_NewViewController *vc3 = self.childViewControllers[3];
    [vc3.navigationItem setTitle:@"新帖"];
    [vc3.tabBarItem setTitle:@"关注"];
    [vc3.tabBarItem setImage:[UIImage imageNamed:@"tabBar_new_icon"]];
    [vc3.tabBarItem setSelectedImage:[UIImage imageNamed:@"tabBar_new_click_icon"]];

    /********************** 新帖**************************************/
    Potts_MeViewController *vc4 = self.childViewControllers[4];
    [vc4.navigationItem setTitle:@"我的"];
    [vc4.tabBarItem setTitle:@"我"];
    [vc4.tabBarItem setImage:[UIImage imageNamed:@"tabBar_me_icon"]];
    [vc4.tabBarItem setSelectedImage:[UIImage imageNamed:@"tabBar_me_click_icon"]];

}

-(void)setupALLchildVC
{
//    精华
    Potts_EssenceViewController* essenceVC = [[Potts_EssenceViewController alloc]init];
    UINavigationController *nac1 = [[UINavigationController alloc]initWithRootViewController:essenceVC];
//    [essenceVC.view setBackgroundColor:[UIColor grayColor]];
    [self addChildViewController:nac1];
    
//    关注
    Potts_FriendTrendViewController *friendT_vc = [[Potts_FriendTrendViewController alloc]init];
    UINavigationController *nac2 = [[UINavigationController alloc]initWithRootViewController:friendT_vc ];
//    [friendT_vc.view setBackgroundColor:[UIColor greenColor]];

    [self addChildViewController:nac2];
    
    
//    发布
    Potts_PublishViewController *pulishVC = [[Potts_PublishViewController alloc]init];
    [self addChildViewController:pulishVC];
    
    
//    新帖
    Potts_NewViewController *newVC = [[Potts_NewViewController alloc]init];
    UINavigationController *nac3 = [[UINavigationController alloc]initWithRootViewController:newVC];
    [self addChildViewController:nac3];
    
    
    
    
//    我的
    
    Potts_MeViewController *MEvc = [[Potts_MeViewController alloc]init];
    
    UINavigationController *nac4 = [[UINavigationController alloc]initWithRootViewController:MEvc];
    
    [self addChildViewController:nac4];
    
    
}



@end
